package com.smh.a13WaitThread2;

import java.util.concurrent.ArrayBlockingQueue;

public class Cook extends Thread {
    ArrayBlockingQueue<String> abq;

    public Cook() {
    }

    public Cook(ArrayBlockingQueue<String> abq) {
        this.abq = abq;
    }

    @Override
    public void run() {
        while (true) {
            try {
                abq.put("面条");//不用写锁,java底层帮忙写了
                //如果你在锁外面写打印语句会造成打印出现问题,但是数据不会错
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }

        }
    }
}
